﻿package bakudo.engines.mapEngine.controller.collision
{
	import bakudo.engines.mapEngine.model.actors.ModelActor;
	import bakudo.engines.mapEngine.utils.HitTest;
	import bakudo.engines.mapEngine.view.scene.actors.SceneActor;
	import flash.display.DisplayObject;
	
	/**
	 * ...
	 * @author Bakudo
	 */
	public class CollisionsController 
	{
		
		public function CollisionsController() 
		{
			trace("\t$COLLISIONS CONTROLLER$ ::: CREATED");
		}
				
		public function check(actors:Array,toCheckAgainst : DisplayObject):void {
			var actor : ModelActor;
			for (var i in actors) {
				actor = actors[i];
				if (actor.getActor()) {
					var sa : DisplayObject = actor.getActor();
					var isHitTest : Boolean = HitTest.complexHitTestObject(actor.getActor(), toCheckAgainst);
					if (isHitTest) actor.showObject();
					if (!isHitTest) actor.hideObject();
				}
			}
		}
		
	}
	
}